# 定义装饰器
def logging(fn):  # fn = sum_num
    def inner(*args, **kwargs):
        print("--正在努⼒计算--")
        result = fn(*args, **kwargs)
        return result

    return inner  # sum_num = inner


# 使用装饰器装饰函数
@logging
def sum_num(*args, **kwargs):
    print(args, kwargs)


sum_num(1, 2, 3, age="18")
sum_num(age="18")
sum_num(1)

"""
小结：
通⽤装饰器的语法格式:
# 通⽤装饰器
def logging(fn):
    def inner(*args, **kwargs):
        print("--正在努⼒计算--")
        result = fn(*args, **kwargs)
        return result
    return inner
"""
